﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNQXYJ.BLL;
using HNQXYJ.Model;
using HNQXYJ.DAL;

namespace HNQXYJ.HN_DATA
{
    public partial class StartListen : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 手动开启监听
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void startListening_Click(object sender, ImageClickEventArgs e)
        {
            SysConfig sc = new SysConfig();
            SysConfigBLL scb = new SysConfigBLL();
            sc = scb.ReturnSysConfig();
            if (sc != null)
            {
                string ip = sc.Ip;
                int port = sc.Port;
                 SocketListen.StartListen("192.168.1.137", 50001);//192.168.70.111
                this.Label1.Text = "监听开启中";
            }
            else
            {
                this.Label1.Text = "监听启动失败";
            }

        }

       
        /// <summary>
        /// 手动关闭监听
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void endListening_Click(object sender, ImageClickEventArgs e)
        {
            SocketListen.EndListen();
            this.Label1.Text = "监听已关闭";
        }
    }
}